<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 逻辑非
    // let isShow = true;
    // console.log(!isShow);

    // 逻辑非会自动做隐式转换
    // 数字非0即真
    let num = 0;
    console.log(!num);
    // 字符串非空即真
    let str = "";
    console.log(!str);

    let nl = null;
    console.log(!nl);

    let udf = undefined;
    console.log(!udf);

    let a = NaN;
    console.log(!a);

    // 只有0, "", null, undefined, NaN是false
    

    // if也有隐式转换
    // if (!!str) {}
    // if (arr.length) {}
    
    
  </script>
</body>
</html>